package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageDto;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {
    int countByCategoryId(Long categoryId);
    @AutoFill(OperationType.INSERT)
    void save(Setmeal setmeal);

    Page<Setmeal> page(SetmealPageDto setmealPageDto);

    Setmeal getSetmealById(Long id);
    @AutoFill(OperationType.UPDATE)
    void updateStatus(Setmeal setmeal);

    void deleteById(Long id);
    @AutoFill(OperationType.UPDATE)
    void modifySetmeal(Setmeal setmeal);

    List<Setmeal> list(Long categoryId);
    @Select("select count(0) from setmeal where  status = 1")
    Integer getSold();
    @Select("select  count(0) from setmeal where  status = 0")
    Integer getDiscontinued();
}
